#include <stdio.h>
#include <string.h>


int main()
{
	int ret = 0;
	FILE *file;
	char buffer[256];
	int roadLength = 0;
	int lineRoad = 0;
	int noTree = 0, tree = 0;
	int roadCount = 0;
	int moving = 0, error = 0;

	printf("Day 3 ! \n");
	
	file = fopen("input.txt", "r");
	if (file == NULL)
		return -1;
	
	fscanf(file, "%s", buffer);
	roadLength = strlen(buffer);
	
	while(!feof(file) )
	{
		fscanf(file, "%s", buffer);
		moving += 3;
		printf("%s ", buffer);
		printf("buffer char : %c ", buffer[moving %roadLength]);

		if (buffer[moving%roadLength] == '.')
			noTree++;
		else if (buffer[moving %roadLength] == '#')
			tree++;
		else
			error++;	
		printf("noTree: %d - Tree: %d\n", noTree, tree);

	}
	printf ("Final: hit %d trees - errors: %d \n", tree, error);
	fclose(file);


	return ret;
}


